package com.neuedu.part10;

import java.util.LinkedList;

public class TestPart1003 {
	public static void main(String[] args) {
		
		MyQueue<String> myQueue = new MyQueue<>();
		myQueue.put("1");
		myQueue.put("2");
		myQueue.put("3");
		myQueue.put("4");
		
		for (int i = 0; i < myQueue.size(); i++) {
			System.out.println(myQueue.get());
		}
		System.out.println(myQueue.isEmpty());
	}

}

class MyQueue<T>{
	
	LinkedList<T> list = new LinkedList<>();
	
	private int  size;
	
	public MyQueue() {
		list= new LinkedList<>();
	}

	public void put(T t) {
		list.addLast(t);
		size++;
	}
	
	public T get() {
		T first = list.getFirst();
		list.remove();
		return first;
	}
	
	public boolean isEmpty() {
		return list.isEmpty();
	}
	
	public int  size() {
		return size;
	}
	
}











